package jezyk_java.robert_wolos.wielowatkowa

import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Author: Daniel
 * Date: 08.08.13
 */

public class BallPanel extends JPanel {
    private List<Ball> balls = new ArrayList<Ball>();

    public void add(Ball b) {
        balls.add(b);
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;
        for (Ball ball : balls) {
            g2.fill(ball.getShape());
        }
    }
}
